Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy HICON after setting it as the window icon #11450

Closed
wants to merge 1 commit into from

Conversation

ramezgerges
Copy link
Contributor

I noticed there is a likely (tiny) leak in SetWindowIcon on Windows.

@expikr
Copy link
Contributor

expikr commented Nov 11, 2024

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroyicon

It is only necessary to call DestroyIcon for icons and cursors created with the following functions: CreateIconFromResourceEx (if called without the LR_SHARED flag), CreateIconIndirect, and CopyIcon. Do not use this function to destroy a shared icon. A shared icon is valid as long as the module from which it was loaded remains in memory. The following functions obtain a shared icon.

@ramezgerges
Copy link
Contributor Author

Oh, neat. Thanks.

@ramezgerges ramezgerges deleted the win32_icon_leak branch November 11, 2024 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants